<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<title>选择模板</title>
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">		
	<link rel="stylesheet" href="css/mui.min.css">
	<link rel="stylesheet" href="css/grandeHealth.css">
	<link rel="stylesheet" type="text/css" href="css/myList.css"/>
	<style>
		.mui-scroll-wrapper {margin: 75px 0;}
		.mui-radio input[type=radio]:checked:before{content: '\e442';}
		.mui-checkbox.mui-left input[type=checkbox], .mui-radio.mui-left input[type=radio]{left: 0;}
		.mui-checkbox.mui-left label, .mui-radio.mui-left label{padding-left: 35px;}
		#OA_task_2 .mui-row a{display: block;line-height: 40px;text-align: right;margin-right: 5px;}
		#OA_task_2 .mui-row{border-bottom: 1px solid #eee;}
		#OA_task_2 .mui-row p{display: none;}
		#submit	{width: 95%;padding: 10px 0;margin: 0 auto;position: fixed;bottom: 20px;left: 2.5%;border: none;}
		.mui-content {height: 87%;}
	</style>
	</head>
	<body>
		<!--<header>class="mui-bar mui-bar-nav" style="display: block;height: 64px;padding-top:20px">
	      <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
	      <h1 class="mui-title">模板管理</h1>
	      <button id="selectTem" disabled="disabled" style="float: right;">确定</button>
	    </header>-->
	    
		<!--下拉刷新容器-->
	    <div class="mui-scroll-wrapper" id="pullrefresh">
      		<div class="mui-scroll">
	        	<!-- 数据列表 -->
				<ul id="OA_task_2" class="mui-table-view">
					<!--<li class="mui-table-view-cell mui-table mui-row">
						<div class="mui-col-xs-9 mui-col-sm-9">
							<div class="mui-input-row mui-radio mui-left">
								<label>感冒健康方案</label>
								<input name="radio1" class="radio" type="radio">
							</div>
						</div>
						<div class="mui-col-xs-3 mui-col-sm-3">
							<a href="javascript:;">查看</a>
						</div>
					</li>-->
       			</ul>
      		</div>
	    </div>
	    
	    <!--暂无记录-->
	    <div class="mui-content" style="display: none;">
      		<div class="nomessage">
		        <img src="images/zanwujilu.png" />
		        <p>暂无记录</p>
      		</div>
	    </div>
    	<button type="button" id="submit" class="mui-btn mui-btn-primary mui-btn-block">创建模板</button>
		
		<script src="js/jquery-1.7.2.min.js"></script>
		<script src="js/mui.minT.js"></script>
		<script src="js/grandeHealth.js"></script>
		<script src="js/medicalRecord.js"></script>
		<script>
			var selectValueh = '';
			/*监听radio是否选中*/
			$("#OA_task_2").on("change",'input[type="radio"]',function(){
			    selectValueh = $('input:radio[name="radio1"]:checked').parents('li').find('p').html();
				$('#selectTem').attr("disabled",null);
			});
			
			/*选择确定*/
			mui("body").on("tap", "#selectTem", function() {
				showpage('healthPlan.html?type='+ type +'&cont=' + selectValueh);
			})
			
			/*查看模板内容*/
			mui("#OA_task_2").on('tap', '.mui-table-view-cell a', function(event) {
				
				var deiContent = $(this).parents('li').find('p').html();
				showpage('viewContent.html?deiContent=' + deiContent);
			})
			
			/*创建模板*/
			mui("body").on('tap', '#submit', function(event) {
				if(type == '001001'){
					showpage('creathealthProgram.html');
				}else if(type == '001002'){
					showpage('creatattentionCase.html');
				}
			})
			
			/**
		       * 页面初始化
	     	*/
			mui.init({
		        pullRefresh: {
		          	container: '#pullrefresh',
		          	down: {
		          		auto: true,
            			callback: pulldownRefresh,
		          	},
	          		up: {
			            contentrefresh: '正在加载...',
			            callback: pullupRefresh,
				      	contentnomore:'没有更多数据了'//可选，请求完毕若没有更多数据时显示的提醒内容；
	          		}
		        }
	      	});
	      	
	      	
			//查询接口 https://tsch.fromfuture.cn:7714/GZ/Docpre/queryPageFollow?userid=5FBCE02158CBE97DE050007F01003979&type=001001&title	
			var webUrl = XHDOC_WEBBASE + 'Docpre/queryPageFollow?type=' + type + '&titl&userid=' + XHDOC_APP_USRGUID;
			
			/**
		       * 下拉刷新具体业务实现
	     	*/
	      	function pulldownRefresh() {
	      		
	      		setTimeout(function () {
	     			
	     			count = 1;
	     			jiaohu(webUrl, { 'pageNo': count }, function (data) {
						
						var table = document.body.querySelector('.mui-table-view');
						table.innerHTML = '';
						
						//最新数据
						addContent(data, table);
						
						mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(null, "正在加载...");
						count++;
					});
					
	          	}, 1000);
	      	}
	
		    /**
		     * 上拉加载具体业务实现
		     */
	      	function pullupRefresh() {
	      		
	      		setTimeout(function () {
				
					jiaohu(webUrl, { 'pageNo': count }, function (data) {
						
						var table = document.body.querySelector('.mui-table-view');
						
						//最新数据
						if (arry.parameterType == '') {
							
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(null, "没有更多数据了");
	
						} else {
							
							//最新数据
							addContent(data, table);
							count++;
							mui('#pullrefresh').pullRefresh().endPullupToRefresh(null, "正在加载...");
						}
					});
	
				}, 1000);
	      	}
	
	      	
	      	function addContent(arry, table) {
				
				if (arry.parameterType == '') {
							
					$('.mui-content').show();

				} else {

					$('.mui-content').hide();
					
					for (var i = 0; i < arry.parameterType.length; i++) {
					
						var li = document.createElement('li');
						li.className = 'mui-table-view-cell mui-table mui-row';
						li.innerHTML = 
								'<div class="mui-col-xs-9 mui-col-sm-9">'+
									'<div class="mui-input-row mui-radio mui-left">'+
										'<label>'+arry.parameterType[i].title+'</label>'+
										'<input name="radio1" class="radio" type="radio">'+
									'</div>'+
								'</div>'+
								'<p>'+arry.parameterType[i].content+'</p>'+
								'<div class="mui-col-xs-3 mui-col-sm-3">'+
									'<a href="javascript:;">查看</a>'+
								'</div>';
						table.appendChild(li);
					}
				}
			}
			
	    </script>
	</body>
</html>


